package com.erlinyou.im.dao.repository.motion;

import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.Query;

import com.erlinyou.base.dao.BaseRepository;
import com.erlinyou.im.model.motion.UserMotion;
import com.erlinyou.im.model.motion.UserMotionKey;

public interface UserMotionRepository extends BaseRepository<UserMotion, UserMotionKey>{

	@Query(value="SELECT userid,stepNum from user_motion_step where createDate = ?2 AND FIND_IN_SET(userid,?1)",nativeQuery=true)
	List<Map<String, Object>> getFriendStepNum(String ids, Long createDate);

	UserMotion findByUseridAndCreateDate(Long userId, long dateTime);

	@Query(value="SELECT createDate,stepNum from user_motion_step WHERE userid=?1 and createDate>?2",nativeQuery=true)
	List<Map<String, Object>> getUserStepNum(int userid, long startTime);

}
